package com.zny.sescore.rule.constant;


import com.zny.sescore.model.CodeName;

import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * @version: V1.0
 * @author: zhangnayi
 * @className: DefaultVariableEnum
 * @packageName: com.zny.sescore.constant
 * @description: 默认变量枚举
 * @data: 2021-08-10 9:15
 **/
@RuleConstant(value = "default_variable", name = "默认变量")
public enum DefaultVariableEnum implements IRuleConstant {

    ITEM_VALUE("itemValue", "项目值"),
    OPTION_VALUE("optionValue", "选项值"),
    TOTAL_SCORE("totalScore", "总得分"),
    ;

    private String code;

    private String name;

    DefaultVariableEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    @Override
    public List<CodeName> codeNames() {
        return Stream.of(values())
                .map(v -> new CodeName(v.code, v.name))
                .collect(Collectors.toList());
    }

    @Override
    public String getCode() {
        return code;
    }

    @Override
    public String getName() {
        return name;
    }
}